<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
   <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
   <%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>客户服务</title>
<jsp:include page="/common/commonCss.jsp"/>
<jsp:include page="/common/commonJs.jsp"/>
<script type="text/javascript">
		var  branId="${branId}";
		function  handleService(idFlag){
				//流程上报,或处理
				var status=$("input:[name='status']:checked").val();
				if(idFlag!='2'){
					status=idFlag;						
				}
				$("input:[name='status']:checked").val(status);
				if(status=="1"){
					$.messager.confirm('温馨提示', '你确定要退单吗?', function(r) {
						if (r) {
							$("#handleForm").submit();
						}
						else{
							return ;
						}
					});
				}else if(status=="3"||status=="4"){
					//选择处理人
					if($("#isNext").attr("checked")=="checked"){
						if(checkIsNull($("#claimUserId").val())){
							alertWarning("请选择下一环节的流程处理人"); 
							return; 
						}
					}
					$.messager.confirm('温馨提示', '你确定要提交吗?', function(r) {
						if (r) {
							$("#handleForm").submit();
						}
						else{
							return ;
						}
					});
				}else if(status=="5"){
					$.messager.confirm('温馨提示', '你确定关闭该流程吗?', function(r) {
						if (r) {
							$("#handleForm").submit();
						}
						else{
							return ;
						}
					});
			}
		}
		function setHandleUser(){
			$("#x").window('close');
			var  obj=$("input:[name='pkUsrId']:checked");
			var  objVal=$(obj).val();
			var userNames=$(obj).attr("userNames");
			$("#claimUserId").val(objVal);
			$("#userName").html(userNames);
		}
		function  getUserInfo(thisObj){
			var  fkBranId=$(thisObj).attr("pkBranId");
			$.ajax({
				url:"${basePath}filemanagement/customer/selectUsesJobInfo.shtml",
				dataType:"json",
				type:"post",
				async:false,
				data:{"fkBranId":fkBranId},
				error : function(XMLHttpRequest) {
  	 				ajaxError(XMLHttpRequest);
  	 			},
				success:function(result){
					trimJsonArray(result);
					var html="";
					$(result).each(function(id,item){
						if(id==0){
							html+='<tr><td><input type="radio" name="pkUsrId"  checked="checked"     userNames="'+item.usrName+'"  jobs="'+item.jobs+'"   value="'+item.pkUsrId+'"></td>'; 
						}else{
							html+='<tr><td><input type="radio" name="pkUsrId"     userNames="'+item.usrName+'"  jobs="'+item.jobs+'"  value="'+item.pkUsrId+'"></td>'; 
						}
						html+='<td>'+item.usrName+'</td>';
						html+='<td>'+item.jobs+'</td></tr>';
					});
					$("#showUserInfo").html(html);
				}
			});		
		}
		function getInfo(fkBranId){
			$.ajax({
				url:"${basePath}filemanagement/customer/selectUsesJobInfo.shtml",
				dataType:"json",
				type:"post",
				async:false,
				data:{"fkBranId":fkBranId},
				error : function(XMLHttpRequest) {
  	 				ajaxError(XMLHttpRequest);
  	 			},
				success:function(result){
					trimJsonArray(result);
					var html="";
					$(result).each(function(id,item){
						if(id==0){
							html+='<tr><td><input type="radio" name="pkUsrId"  checked="checked"    userNames="'+item.usrName+'"  jobs="'+item.jobs+'"  value="'+item.pkUsrId+'"></td>'; 
						}else{
							html+='<tr><td><input type="radio" name="pkUsrId"     userNames="'+item.usrName+'"  jobs="'+item.jobs+'" value="'+item.pkUsrId+'"></td>'; 
						}					
						html+='<td>'+item.usrName+'</td>';
						html+='<td>'+item.jobs+'</td></tr>';
					});
					$("#showUserInfo").html(html);
				}
			});		
		}
		function  selectUser(){
			$('#x').window('open');
			getInfo(branId);
		}

</script>
</head>
<body class="bg">
<div class="content m_auto">
	<div class="content_l mt10">
    	<ul>
    			<shiro:hasPermission name="filemanagement/listVip.shtml?type=1">
    						<li><a href="${basePath}filemanagement/listVip.shtml?type=1"><i class="nav_icon_b"></i><br>会员管理</a></li>
    			</shiro:hasPermission>
    			<shiro:hasPermission name="filemanagement/viewVistors.shtml?type=3">
            			<li><a href="${basePath}filemanagement/viewVistors.shtml?type=3"><i class="nav_icon_d"></i><br>访客管理</a></li>
    			</shiro:hasPermission>
    			<shiro:hasPermission name="filemanagement/listViewSingelTicket.shtml?type=2">
           				<li><a href="${basePath}filemanagement/listViewSingelTicket.shtml?type=2"><i class="nav_icon_a"></i><br>非会员管理</a></li>
    			</shiro:hasPermission>
    			<shiro:hasPermission name="parreserve/parReserveManages.shtml?indexflag=">
					<li><a href="${basePath }parreserve/parReserveManages.shtml?indexflag="><i class="nav_icon_g"></i><br>预约管理</a></li>
    			</shiro:hasPermission>
    			<shiro:hasPermission name="filemanagement/customer/serviceList.shtml">
						<li  class="content_hover"><a href="${basePath}filemanagement/customer/serviceList.shtml"><i class="nav_icon_h"></i><br>客户服务</a></li>
    			</shiro:hasPermission>
    			<shiro:hasPermission name="crm/jumpCrm.shtml">
						<li><a href="${basePath }crm/jumpCrm.shtml"><i class="nav_icon_n"></i><br>客户关系管理</a></li>
    			</shiro:hasPermission>
</ul>
    </div>
    <form action="${basePath}filemanagement/customer/handleAppServier.shtml" id="handleForm" method="post">
    <input type="hidden" name="claimUserId" id="claimUserId"/>
     <input type="hidden" name="pkCareformId" id="pkCareformId"  value="${entity.pkCareformId}"/>
      <input type="hidden" name="fkFlowinstId" id="fkFlowinstId"       value="${entity.fkFlowinstId}"/>
    <div class="content_r mt10">
        <div class="file_apply_l fixed mt50 border_r">
            <dl class="order_add_l_dl">
                <dd><label>服务请求类型：</label>申请</dd>
                <dd><label>服务请#：</label><input type="text" disabled value="${entity.pkCareformId}" class="iput_t w200"></dd>
                <dd><label>创建人：</label><input type="text" disabled value="${entity.userName}" class="iput_t w200"></dd>
                <dd><label>创建时间 ：</label><input type="text" disabled value="${entity.createStartTime}" class="iput_t w200"></dd>
                <dd>
                    <label>途径：</label>
                    <c:choose>
                    		<c:when test="${entity.channel=='1'}">
                    			<input type="text" value="电话" disabled="disabled" class="iput_t w200">
                    		</c:when>
                    		<c:when test="${entity.channel=='2'}">
                    		 	 <input type="text" value="现场" disabled="disabled" class="iput_t w200">
                    		</c:when>
                    		<c:otherwise>
								<input type="text" value="邮件" disabled="disabled" class="iput_t w200">
                    		</c:otherwise>
                    </c:choose>
                </dd>
                <dd><label>姓名：</label><input type="text" value="${entity.cusName}" disabled="disabled" class="iput_t w200"></dd>
                <dd><label>固话：</label><input type="text" value="${entity.tel}"  disabled="disabled"   class="iput_t w200"></dd>
                <dd><label>手机：</label><input type="text" value="${entity.mobile}" disabled="disabled" class="iput_t w200"></dd>
                <dd><label>备注：</label><textarea class="textare w200 h80" disabled="disabled">${entity.comments}</textarea></dd>
            </dl>
        </div>
        <div class="file_apply_r f14 p20 mt30">
            <div class="fl w630" id="case2">
                <dl class="order_add_l_dl">
                    <dd><label><b>当前状态：</b></label>${entity.workflowVo.statusDesc }</dd>
                    <dd><label><b>当前处理人：</b></label>${ entity.workflowVo.currtOptUser}</dd>
                    <dd><label><b>处理历史</b></label></dd>
                    <dd style="margin-left:50px;">
                        <table class="table">
                            <tr>
                                <th>时间</th>
                                <th>处理人</th>
                                <th>结果</th>
                                <th>备注</th>
                            </tr>
                             <!-- 处理历史 -->
                                <c:forEach items="${entity.workflowVo.optHisVoList}" var="his">
                                				<tr>
														<td style="width: 40%">${his.optTime }</td>
														<td>${his.optName }</td>
														<td>${his.result }</td>
														<td title="${his.advice}">
														<c:if test="${his.advice != null}">
															<c:choose>
																<c:when test="${his.advice.length() > 5}">
																	${his.advice.substring(0,5)}...
																</c:when>
																<c:otherwise>
																	${his.advice}
																</c:otherwise>
															</c:choose>
														</c:if>
														</td>
												</tr>
                                </c:forEach>
                        </table>
                    </dd>
                </dl>
                <br>
                <div class="btm_btn">
                    <dl>
                            <dd><input type="button" class="btn" value="返回" onclick="window.location.href='${basePath}filemanagement/customer/serviceList.shtml'" ></dd>
                    </dl>
                </div>
            </div>
        </div>
    </div>
    </form>
</div>
<!---弹出层--->
<div id="x" class="easyui-window" title="选择处理人" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:620px; height:420px; position:relative;">
	
    <div class="m10">
    	<dl class="order_add_peic fl">
            <dd style="text-indent:12px;">嘉童</dd>
            <c:forEach items="${branList}" var="item">
            	<dd><a href="#" pkBranId="${item.pkBranId}" onclick="getUserInfo(this);" >${item.branName}</a></dd>
            </c:forEach>
        </dl>
        <div id="scrollTable" class="file_apply_m fl" style="width:440px !important; margin-top:0 !important">
            <table class="table">
                <col width="80px"></col>
                <col width="160px"></col>
                <col></col>
                <tbody>
                    <tr>
                        <th>选择</th>
                        <th>姓名</th>
                        <th>职位</th>
                    </tr>
                </tbody>
            </table>
			<div style="height:270px !important">
            <table class="table" id="selectProduct" >
				<col width="80px"></col>
                <col width="160px"></col>
                <col></col>
                <tbody id="showUserInfo">
					
                </tbody>
            </table>
            </div>
        </div>
    </div>
    <div class="btm_btn btm_bg">
    	<dl>
        	<dd><input type="button" class="btn" onclick="setHandleUser();" value="确定"></dd>
            <dd><input type="button" class="btn" onclick="$('#x').window('close');" value="取消"></dd>
        </dl>
    </div>
</div>
</body>
</html>